<template>
  <t-dialog
    :visible="props.visible"
    header="移交展览"
    body="对话框内容"
    :confirm-on-enter="true"
    :on-close="close"
    :on-confirm="onConfirmAnother"
  >
    <div>
      <div class="radio-title-box nav-title">请选择一位单位成员</div>
      <t-radio-group v-model="radioType" @change="onChange" style="width: 100%">
        <div class="scroll-bos">
          <t-row v-for="item in listMembers" :key="item.userId">
            <t-col :span="7">
              <div class="radio-left hw-box-style-flex">
                <div class="radio-left-img">
                  <img :src="urls + item.coverUrl" alt="" v-if="item.coverUrl" />
                  <img
                    src="https://static-1316349889.cos.ap-shanghai.myqcloud.com/assets/img/userImg.png"
                    alt=""
                    v-else
                  />
                </div>
                <div class="hw-box-style-flex hw-box-style-flex-clm">
                  <span class="radio-left-text1">{{ item.name }}</span>
                  <span class="radio-left-text2">{{ item.phone }}</span>
                </div>
              </div>
            </t-col>
            <t-col :span="1" :offset="4">
              <t-radio allow-uncheck :value="item.userId" :disabled="item.isOneself"></t-radio>
            </t-col>
          </t-row>
        </div>
      </t-radio-group>
    </div>
  </t-dialog>
</template>

<script setup lang="ts">
// @ts-nocheck
import { urls } from '@/utils/request/upload';
import { ref } from 'vue';
import { members } from '@/api/project/project';

const props = defineProps({
  visible: {
    type: Boolean,
  },
});
const emit = defineEmits(['close', 'moveClose']);
const listMembers = ref([]);
const radioType = ref(0);
const initGroup = async (e?: String) => {
  try {
    let res = await members(localStorage.getItem('projectId'), -1);

    listMembers.value = res.data;
  } catch {}
};
const onChange = (e: any) => {};
const close = (context) => {
  //关闭弹框
  emit('close');
};
const onConfirmAnother = (context) => {
  // console.log('点击了确认按钮', context);
  emit('moveClose', radioType.value);
};
initGroup();
</script>

<style lang="less" scoped>
.radio-title-box {
  margin-bottom: 20px;
  font-size: 16px;
}
.scroll-bos {
  padding: 20px;
  width: 100%;
  height: 400px;
  overflow-y: scroll;
  overflow-x: hidden;
  border: 1px solid rgba(231, 231, 231, 1);
}
.radio-left-img {
  width: 48px;
  height: 48px;
  background: #d8d8d8;
  margin-right: 10px;
  img {
    width: 48px;
    height: 48px;
    background: #d8d8d8;
    margin-right: 10px;
  }
}
.radio-left-text1 {
  font-size: 16px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.9);
  line-height: 22px;
}
.radio-left-text2 {
  font-size: 16px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.4);
  line-height: 22px;
}
.radio-title-box {
  margin-bottom: 20px;
}
</style>
